<?php
/**
 * 后台登陆和退出
 * Created by PhpStorm.
 * User: m1514
 * Date: 2016/12/26
 * Time: 9:53
 */

namespace Admin\Controller;


use Common\Controller\AdminController;

class LoginController extends AdminController
{
    public function index()
    {

        if(IS_POST){


            $user=new \Common\Model\UserModel();
            if($user->Login()){

                $this->redirect('Index/index');die;
            }else{
                $this->error($user->getError(),u('Login/index'),2);die;
            }
        }
            $this->display();


    }
    //退出登录
    public function out(){
        session_unset();
        session_destroy();
       $this->success('退出成功',u('Login/index'),2);die;
    }
    //验证码
    public function code(){
        $Verify = new \Think\Verify();
        $Verify->entry();

    }

}